package queue;

/**
 * Created by zhaoxin on 2018/7/12.
 */
public class Main {

    public static double test(Queue<Integer> queue, int count){

        long startTime = System.nanoTime();

        for (int i = 0; i < count; i++) {
            queue.enqueue(i);
        }
        for (int i = 0; i < count; i++) {
            queue.dequeue();
        }

        long endTime = System.nanoTime();

        return (endTime - startTime) / 1000000000.0;
    }



    public static void main(String[] args) {
        int capacity = 100000;
        ArrayQueue<Integer> arrayQueue = new ArrayQueue<>();
        LoopQueue<Integer> loopQueue = new LoopQueue<>();

        System.out.println("数组队列:" + test(arrayQueue, capacity));
        System.out.println("循环队列:" + test(loopQueue, capacity));
    }


}
